package edu.gatech.volt2.drdoommgt.gui;

import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.JButton;

@SuppressWarnings("serial")
public class PatientWindow extends JFrame implements IPatientView{

	private JPanel contentPane;
	private JButton appointmentButton;
	private JButton medHistButton;
	private JButton exitButton;


	/**
	 * @return the appointmentButton
	 */
	public JButton getAppointmentButton() {
		return appointmentButton;
	}

	/**
	 * @return the medical history button
	 */
	public JButton getMedHistButton() {
		return medHistButton;
	}
	
	/**
	 * @return the exitButton
	 */
	public JButton getExitButton() {
		return exitButton;
	}

	/**
	 * Create the frame.
	 */
	public PatientWindow() {
		setResizable(false);
		setTitle("Dr. Doom Management");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JPanel panel = new JPanel();
		panel.setBounds(5, 5, 424, 246);
		contentPane.add(panel);
		panel.setLayout(null);
		
		JLabel optionLabel = new JLabel("What would you like to do?");
		optionLabel.setHorizontalAlignment(SwingConstants.CENTER);
		optionLabel.setBounds(120, 30, 177, 29);
		panel.add(optionLabel);
		
		appointmentButton = new JButton("Request an Appointment");
		appointmentButton.setBounds(120, 88, 180, 30);
		panel.add(appointmentButton);
		
		medHistButton = new JButton("View Medical History");
		medHistButton.setBounds(120, 129, 180, 30);
		panel.add(medHistButton);
		
		exitButton = new JButton("Logout");
		exitButton.setBounds(354, 223, 70, 23);
		panel.add(exitButton);
	}

	@Override
	public void addListener(ActionListener al) {
		medHistButton.addActionListener(al);
		appointmentButton.addActionListener(al);
		exitButton.addActionListener(al);
	}

	public void showSelf(){
		this.setVisible(true);
	}
	
	public void hideSelf(){
		this.setVisible(false);
	}
}
